use axum::{
    routing::{get, post, put, delete},
    Router,
};
use std::sync::Arc;
use crate::{handlers, AppState};

pub fn create_routes() -> Router<Arc<AppState>> {
    Router::new()
        // 健康检查
        .route("/health", get(handlers::health::health_check))
        
        // 连接器管理
        .route("/connectors", get(handlers::connectors::list_connectors))
        .route("/connectors", post(handlers::connectors::create_connector))
        .route("/connectors/:id", get(handlers::connectors::get_connector))
        .route("/connectors/:id", put(handlers::connectors::update_connector))
        .route("/connectors/:id", delete(handlers::connectors::delete_connector))
        .route("/connectors/:id/test", post(handlers::connectors::test_connector))
        
        // 连接管理
        .route("/connections", get(handlers::connections::list_connections))
        .route("/connections", post(handlers::connections::create_connection))
        .route("/connections/:id", get(handlers::connections::get_connection))
        .route("/connections/:id", put(handlers::connections::update_connection))
        .route("/connections/:id", delete(handlers::connections::delete_connection))
        .route("/connections/:id/start", post(handlers::connections::start_connection))
        .route("/connections/:id/stop", post(handlers::connections::stop_connection))
        
        // 管道管理
        .route("/pipelines", get(handlers::pipelines::list_pipelines))
        .route("/pipelines", post(handlers::pipelines::create_pipeline))
        .route("/pipelines/:id", get(handlers::pipelines::get_pipeline))
        .route("/pipelines/:id/metrics", get(handlers::pipelines::get_pipeline_metrics))
        
        // Fluvio主题管理
        .route("/topics", get(handlers::topics::list_topics))
        .route("/topics", post(handlers::topics::create_topic))
        .route("/topics/:name", delete(handlers::topics::delete_topic))
        .route("/topics/:name/records", get(handlers::topics::get_topic_records))
        
        // AI助手
        .route("/ai/suggest", post(handlers::ai::suggest_configuration))
        .route("/ai/analyze", post(handlers::ai::analyze_data_quality))
}
